﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Base.Master" AutoEventWireup="true"
    CodeBehind="ManageServices.aspx.cs" Inherits="masterview.WebForm4" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script language="javascript" type="text/javascript">
    ssm.isActive = "<%=ssm.IsActive%>";
    ssm.message = "<%=ssm.Message%>";
    ssm.title = "<%=ssm.Title%>";
    ssm.type = <%=ssm.NotifyType%>;
    function onPageLoad() {
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <table width="100%">
        <tr style="vertical-align: top">
            <td style="width: 50%">
                <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                    CellPadding="4" DataKeyNames="INSTALL_ID" DataSourceID="SqlDataSource1" ForeColor="#333333"
                    GridLines="None" Width="100%" AllowPaging="True" EnableViewState="True">
                    <AlternatingRowStyle BackColor="White" Height="100%" ForeColor="#284775" />
                    <Columns>
                        <asp:CommandField ShowSelectButton="True" />
                        <asp:BoundField DataField="INSTALL_ID" HeaderText="INSTALL_ID" InsertVisible="False"
                            ReadOnly="True" SortExpression="INSTALL_ID" Visible="False" />
                        <asp:TemplateField HeaderText="Service" SortExpression="COMPUTER_NAME">
                            <ItemTemplate>
                                <div>
                                    <b>
                                        <%#Eval("COMPUTER_NAME")%></b> on
                                    <%# ((String)Eval("SETTING_VALUE")).Substring(((String)Eval("SETTING_VALUE")).IndexOf("CMNBS"),((String)Eval("SETTING_VALUE")).IndexOf(";P")-((String)Eval("SETTING_VALUE")).IndexOf("CMNBS")) %><br />
                                    <span style="font-size: smaller; color: Gray;">
                                        <%#Eval("SETTING_VALUE")%></span>
                                </div>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EditRowStyle BackColor="#999999" />
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationConfiguration %>"
                    SelectCommand="SELECT APPLICATION_INSTALL.COMPUTER_NAME, APPLICATION_INSTALL_SETTINGS.SETTING_VALUE, APPLICATION_INSTALL.INSTALL_ID FROM APPLICATION_INSTALL INNER JOIN APPLICATION_INSTALL_MAP ON APPLICATION_INSTALL.INSTALL_ID = APPLICATION_INSTALL_MAP.INSTALL_ID INNER JOIN APPLICATION_INSTALL_SETTINGS ON APPLICATION_INSTALL_MAP.INSTALL_MAP_ID = APPLICATION_INSTALL_SETTINGS.INSTALL_MAP_ID WHERE (APPLICATION_INSTALL_SETTINGS.SETTING_NAME = 'CMSConnectionString')">
                </asp:SqlDataSource>
            </td>
            <td style="width: 50%">
                <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" CellPadding="4"
                    DataKeyNames="CS_ID" DataSourceID="SqlDataSource2" ForeColor="#333333" GridLines="None"
                    Width="100%" AllowSorting="True" AllowPaging="True">
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" Height="100%" />
                    <Columns>
                        <asp:CommandField ShowSelectButton="True" />
                        <asp:BoundField DataField="CS_ID" HeaderText="CS_ID" InsertVisible="False" ReadOnly="True"
                            SortExpression="CS_ID" Visible="False" />
                        <asp:TemplateField HeaderText="Database" SortExpression="CS_ALIAS">
                            <ItemTemplate>
                                <div>
                                    <b>
                                        <%#Eval("CS_ALIAS")%></b><span style="font-size: smaller"><%#Eval("CS_DESCRIPTION")%></span><br />
                                    <span style="font-size: smaller; color: Gray;">
                                        <%#Eval("CS_FULL_STRING")%></span>
                                </div>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EditRowStyle BackColor="#999999" />
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:LocalDataBase %>"
                    SelectCommand="SELECT [CS_ALIAS], [CS_ID], [CS_FULL_STRING], [CS_DESCRIPTION] FROM [CONNECTION_STRING] WHERE ([CS_IS_ACTIVE] = @CS_IS_ACTIVE)">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="True" Name="CS_IS_ACTIVE" Type="Boolean" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
    </table>
    <hr />
    <asp:Button ID="Button1" runat="server" Text="Set database for current service" onclick="Button1_Click" />
    <asp:Label ID="Label1"
        runat="server" Text=""></asp:Label>
</asp:Content>

